<template>
  <div class="list">
    <div
      class="item"
      :class="[value == item.value ? 'item-on' : '', size === 'small' ? 'item-small' : '']"
      @click="onTab(item)"
      v-for="item in list"
      :key="item.value"
    >
      {{ $t(item.title) }}
    </div>
  </div>
</template>

<script>
export default {
  name: 'tab',
  props: {
    list: {
      type: Array,
      default() {
        return [];
      },
    },
    value: {
      type: String,
      default: '',
    },
    size: {
      type: String,
      default: '',
    },
  },
  data() {},
  methods: {
    onTab(item) {
      this.$emit('update:value', item.value);
    },
  },
};
</script>

<style scoped lang="scss">
.list {
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  .item {
    margin-right: 110px;
    font-weight: 400;
    font-size: 24px;
    color: #ffffff;
    line-height: 60px;
    transition: 0.3s ease;
    position: relative;
    cursor: pointer;
    &:before {
      content: '';
      width: 24px;
      @include horizontal();
      height: 4px;
      background: #1fd267;
      border-radius: 4px;
      opacity: 0;
      transition: 0.3s ease;
      bottom: 0px;
      transform: translateY(5px);
    }
    &:first-child {
      margin-left: 30px;
    }
    &.item-small {
      font-size: 20px;
    }
  }
  .item-on {
    color: $color;
    &:before {
      transform: translateX(0px);
      opacity: 1;
    }
  }
}
</style>
